<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor=#4DFFFF>
<form action="receive.jsp" method="post" onsubmit="return c();">

<h1 class="text" style=" text-align:center;">火车票售票系统</h1>
<div style="margin-top:82px;text-align: center;">
<body background="2.jpg">
<br>
始发站：<input type="text" id="sfz" name="sfz">
<br>
终点站：<input type="text" id="zdz" name="zdz">
<br>
日期：<input type="text" id="time" name="time" placeholder="xxxx-xx-xx" >
<br>
车票类型：
<select name="cplx">
  <option>学生票</option>
  <option>高铁动车</option>
</select>
<br>
购票人姓名：<input type="text" id="name" name="name">
<br>
购票人身份证：<input type="text" id="id" name="id" placeholder="请输入18位证件号码！">
<br>
<input type=submit value="提交订单">
</div>

</form>
<script type="text/javascript">
    // 验证输入不为空的脚本代码
    function c() {
    	var sfz = document.getElementById("sfz").value;
    	var zdz = document.getElementById("zdz").value;
    	var time= document.getElementById("time").value;
    	var name = document.getElementById("name").value;
    	var id = document.getElementById("id").value;
        if(sfz== "") {
            alert("请输入始发站!");
            return false;
        }
        if(zdz== "") {
        	alert("请输入终点站!");
            return false;
        }
        if(time == "") {
        	alert("请输入年份!");
            return false;
        }
        if(name == "") {
        	alert("请输入姓名!");
            return false;
        }
        if(id == "") {
        	alert("请输入身份证号码!");
            return false;
        }
        return true;
    }
</script>
</body>
</html>